<template>
  <div class="wrap">
    <el-row>
      <el-col :span="24" class="header-wrap">
        <el-form :inline="true" :model="formInline" :rules="rules"  ref="formInline">
          <el-form-item label="真实姓名" prop="name">
            <el-input v-model="formInline.name" prefix-icon="el-icon-search"></el-input>
          </el-form-item>
          <el-form-item label="手机号码" prop="phone">
            <el-input v-model="formInline.phone" prefix-icon="el-icon-search"></el-input>
          </el-form-item>
          <el-form-item label="订单状态" prop="state">
            <el-select v-model="formInline.state" placeholder="请选择订单状态">
              <el-option label="审核中" value="0"></el-option>
              <el-option label="审核失败" value="1"></el-option>
              <el-option label="审核通过" value="2"></el-option>
              <el-option label="全部" value=""></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="search('formInline')">搜索</el-button>
            <el-button type="primary" @click="reset('formInline')">重置</el-button>
            <!--<el-button type="primary"  icon="el-icon-printer" @click="outExe">导出</el-button>-->
          </el-form-item>
        </el-form>
      </el-col>
      <!--表格-->
      <el-col :span="24">
        <el-table :data="borrowOrderList" :border="true" style="width: 100%;min-width: 1200px;">
          <el-table-column label="订单号" align="center" min-width="160px;">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.m" type="success">{{ scope.row.orderNo }}</el-tag>
              <span v-else>{{ scope.row.orderNo }}</span>
            </template>
          </el-table-column>
          <el-table-column label="真实姓名" align="center">user
            <template slot-scope="scope">
              <span>{{ scope.row.realName  }}</span>
            </template>
          </el-table-column>
          <el-table-column label="手机号" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.phone }}</span>
            </template>
          </el-table-column>
          <el-table-column label="借款金额" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.loanAmount  }}</span>
            </template>
          </el-table-column>
          <el-table-column label="服务费" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.feeTotal }}</span>
            </template>
          </el-table-column>
          <el-table-column label="实际到账金额" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.actualAmount }}</span>
            </template>
          </el-table-column>
          <el-table-column label="申请日期" align="center" min-width="160px;">
            <template slot-scope="scope">
              <span>{{ scope.row.createTime }}</span>
            </template>
          </el-table-column>
          <el-table-column label="状态" align="center">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.status == 0">审核中</el-tag>
              <el-tag type="warning" v-if="scope.row.status == 1">审核失败</el-tag>
              <el-tag type="success" v-if="scope.row.status == 2">审核通过</el-tag>
              <el-tag type="success" v-if="scope.row.status == 3">审核通过</el-tag>
              <el-tag type="success" v-if="scope.row.status == 4">审核通过</el-tag>
            </template>
          </el-table-column>

          <el-table-column label="备注" align="center">
            <template slot-scope="scope">
              <el-popover trigger="hover" placement="top">
                <p style="width: 150px;line-height: 1.5;">{{ scope.row.remark }}</p>
                <div slot="reference" class="name-wrapper">
                  <p style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{ scope.row.remark }}</p>
                </div>
              </el-popover>
            </template>
          </el-table-column>

          <el-table-column label="操作" align="center" min-width="200px;">
            <template slot-scope="scope">
              <el-button
                size="mini" @click="check(scope.$index, scope.row)" type="primary"
              >查看</el-button>
              <el-button size="mini" @click="agree(scope.$index, scope.row)"
                         v-show="scope.row.status == 0"
                         type="warning"
              >通过</el-button>
              <el-button size="mini" @click="unagree(scope.$index, scope.row)" type="danger"
                         v-show="scope.row.status == 0"
              >拒绝</el-button>
              <el-button size="mini" type="primary" @click="remark(scope.$index, scope.row)">备注</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          class="top"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[10, 15, 20, 30]"
          :page-size="size"
          layout="total, sizes, prev, pager, next, jumper"
          :total='total'>
        </el-pagination>
      </el-col>

      <el-dialog title="详细信息" :visible.sync="dialogTableVisible" :close-on-click-modal="false" fullscreen width="70%" @close="close">
        <!--图片预览框-->
        <big-img v-if="showImg" @clickit="viewImg" :imgSrc="imgSrc"></big-img>
        <big-img v-if="showImg1" @clickit="viewImg1" :imgSrc="imgSrc1"></big-img>
        <el-tabs type="border-card">
        <el-tab-pane label="基本信息">

          <el-row class="pad">
            <el-col :span="24" class="head-line">借款信息</el-col>
            <el-col :span="24">
              <el-col :span="6">
                <span>订单号：</span>
                <el-tag type="info">{{ borrowDetail.orderNo }}</el-tag>
              </el-col>
              <el-col :span="6">
                <span>真实姓名：</span>
                <el-tag type="info">{{ borrowDetail.realName }}</el-tag>
              </el-col>
              <el-col :span="6">
                <span>手机号：</span>
                <el-tag type="info">{{ borrowDetail.phone }}</el-tag>
              </el-col>
              <el-col :span="6">
                <span>借款期限：</span>
                <el-tag type="info">{{ borrowDetail.loanTerm }}</el-tag>
              </el-col>
            </el-col>

            <el-col :span="24">
              <el-col :span="6">
                <span>借款金额：</span>
                <el-tag type="info">{{ borrowDetail.loanAmount }}</el-tag>
              </el-col>
              <el-col :span="6">
                <span>服务费：</span>
                <el-tag type="info">{{ borrowDetail.feeTotal }}</el-tag>
              </el-col>
              <el-col :span="6">
                <span>实际到账金额：</span>
                <el-tag type="info">{{ borrowDetail.actualAmount }}</el-tag>
              </el-col>
              <el-col :span="6">
                <span>申请日期：</span>
                <el-tag type="info" :formatter="dateFormat">{{ borrowDetail.createTime }}</el-tag>
              </el-col>
            </el-col>
          </el-row>

         <!-- <el-row class="pad">
            <el-col :span="24" class="head-line">紧急联系人</el-col>
            <el-col :span="24">
              <el-col :span="6">
                <span>真实姓名：</span>
                <el-tag type="info">{{ borrowDetail.realName }}</el-tag>
              </el-col>
              <el-col :span="6">
                <span>手机号：</span>
                <el-tag type="info">{{ borrowDetail.phone }}</el-tag>
              </el-col>
            </el-col>
          </el-row>-->

          <el-row :gutter="20">
            <el-col :span="24">
              <el-col :span="24">
                <el-col :span="24" class="head-line IDCard my_pic">人脸照片</el-col>
                <!--<el-card class="card_pic" >-->
                <el-col :span="6" v-for=" (item, key) in images" :key="key">
                  <img class="ocrr" :src="item" alt="ocrImg" @click="clickImg2($event)">
                </el-col>
                <!--<div class="ocr" >-->
                <!---->
                <!--</div>-->
                <!--</el-card>-->
              </el-col>
            </el-col>
          </el-row>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-col :span="24" class="head-line IDCard">身份证信息</el-col>
            <el-col :span="10">
              <p class="card-center">身份证正面</p>
              <el-card>
                <div class="center">
                  <img :src="info.frontImg" alt="frontImg" @click="clickImg($event)">
                </div>
              </el-card>
            </el-col>
            <el-col :span="10">
              <p class="card-center">身份证反面</p>
              <el-card>
                <div class="center">
                  <img :src="info.backImg" alt="backImg" @click="clickImg1($event)">
                </div>
              </el-card>
            </el-col>
            <!--<el-col :span="4">
              <p class="card-center">人脸照片</p>
              <el-card>
                <div class="ocr">
                  <img class="ocrr" :src="info.ocrImg" alt="ocrImg" @click="clickImg2($event)">
                </div>
              </el-card>
            </el-col>-->
          </el-col>
        </el-row>

        <el-row class="pad">
          <el-col :span="24" class="head-line">基本信息</el-col>
          <el-col :span="24">
            <el-col :span="6">
              <span>真实姓名：</span>
              <el-tag type="info">{{ info.realName }}</el-tag>
            </el-col>
            <el-col :span="6">
              <span>注册手机：</span>
              <el-tag type="info">{{ info.phone }}</el-tag>
            </el-col>
            <el-col :span="6">
              <span>身份证：</span>
              <el-tag type="info">{{ info.idNo }}</el-tag>
            </el-col>
          </el-col>
          <el-col :span="24">
            <el-col :span="6">
              <span>银行卡：</span>
              <el-tag type="info">{{ bank.cardNo }}</el-tag>
            </el-col>
            <el-col :span="6">
              <span>所属银行：</span>
              <el-tag type="info">{{ bank.bank }}</el-tag>
            </el-col>
            <el-col :span="6">
              <span>预留手机号：</span>
              <el-tag type="info">{{ bank.phone }}</el-tag>
            </el-col>
          </el-col>
          <el-col :span="24">
            <el-col :span="6">
              <span>注册时间：</span>
              <el-tag type="info">{{ info.createTime }}</el-tag>
            </el-col>
          </el-col>
          <el-col :span="24">
            <el-col :span="10">
              <span>居住地址：</span>
              <el-tag type="info">{{ info.liveAddrDetail }}</el-tag>
            </el-col>
          </el-col>
          <el-col :span="24">
            <el-col :span="10">
              <span>注册所在地：</span>
              <el-tag type="info">{{ info.companyAddr }}</el-tag>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="pad">
          <el-col :span="24" class="head-line">认证状态</el-col>
          <el-col :span="24">
            <el-col :span="8">
              <span>身份认证状态：</span>
              <el-tag type="info" v-if='this.clientAuth.idState == 0'>未认证</el-tag>
              <el-tag type="info" v-if='this.clientAuth.idState == 1'>已认证</el-tag>
              <el-tag type="info" v-if='this.clientAuth.idState == 2'>认证失败</el-tag>
              <el-tag type="info" v-if='this.clientAuth.idState == 3'>认证中</el-tag>
            </el-col>
            <el-col :span="8">
              <span>个人信息状态：</span>
              <el-tag type="info" v-if='this.clientAuth.privateMsg == 0'>未认证</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.privateMsg == 1'>已认证</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.privateMsg == 2'>认证失败</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.privateMsg == 3'>认证中</el-tag>
            </el-col>
            <el-col :span="8">
              <span>学历认证状态：</span>
              <el-tag type="info" v-if='this.clientAuth.jobSchool == 1'>已认证</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.jobSchool == 0'>未认证</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.jobSchool == 2'>认证失败</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.jobSchool == 3'>认证中</el-tag>
            </el-col>
          </el-col>
          <el-col :span="24">
            <el-col :span="8">
              <span>职业认证状态：</span>
              <el-tag type="info" v-if='this.clientAuth.jobSchool == 1'>已认证</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.jobSchool == 0'>未认证</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.jobSchool == 2'>认证失败</el-tag>
              <el-tag type="info" v-else-if='this.clientAuth.jobSchool == 3'>认证中</el-tag>
            </el-col>
          </el-col>
        </el-row>
        <!--</el-tab-pane>-->
          <!--<el-tab-pane label="借款详情">-->
           </el-tab-pane>

          <!--<el-tab-pane label="通讯录">
            <el-table :data="phoneList" :border="true" style="width: 100%" :default-sort = "{prop: 'count', order: 'descending'}">
              <el-table-column prop="contacts" label="姓名" align="center"></el-table-column>
              <el-table-column prop="contactsPhone" label="手机号码" align="center"></el-table-column>
              <el-table-column prop="count" label="通话时长(分钟)" sortable align="center"></el-table-column>
            </el-table>
          </el-tab-pane>-->

          <el-tab-pane label="通讯录">
            <el-table :data="dataContacts" :border="true" style="width: 100%"  :default-sort = "{prop: 'count', order: 'descending'}">
              <el-table-column prop="contacts" label="姓名" align="center"></el-table-column>
              <el-table-column prop="contactsPhone" label="手机号码" align="center"></el-table-column>
            </el-table>
          </el-tab-pane>

          <el-tab-pane label="通话记录">
            <el-table :data="dataContacts" :border="true" style="width: 100%"  :default-sort = "{prop: 'duration', order: 'descending'}">
              <el-table-column prop="contacts" label="姓名" align="center"></el-table-column>
              <el-table-column prop="contactsPhone" label="手机号码" align="center"></el-table-column>
              <el-table-column prop="duration" label="通话时间" sortable align="center"></el-table-column>
            </el-table>
          </el-tab-pane>

          <el-tab-pane label="紧急联系人">
            <el-table :data="dataUrgent" :border="true" style="width: 100%">
              <el-table-column prop="contacts" label="姓名" align="center"></el-table-column>
              <el-table-column prop="contactsPhone" label="手机号码" align="center"></el-table-column>
            </el-table>
          </el-tab-pane>

          <el-tab-pane label="短信">
            <el-table :data="dataContactsSms" :border="true" style="width: 100%">
              <el-table-column prop="contactsPhone" label="手机号码" align="center"></el-table-column>
              <el-table-column prop="body" label="内容" align="center"></el-table-column>
              <el-table-column prop="data" label="日期时间" align="center"></el-table-column>
            </el-table>
          </el-tab-pane>

          <el-tab-pane label="风险评估信息">
            <table class="table" style="width: 100%" cellspacing="0" cellpadding="0">
              <tr>
                <th>名称</th>
                <th>数量</th>
              </tr>
             <!-- <tr>
                <td align="center">注册使用的不同网贷平台数目</td>
                <td align="center">{{ addressList.itfin_registers}}</td>
              </tr>-->
              <tr>
                <td align="center">在多少不同网贷平台提出过申请</td>
                <td align="center">{{ addressList.itfin_loan_applications}}</td>
              </tr>
              <tr>
                <td align="center">在多少不同网贷平台被拒绝</td>
                <td align="center">{{ addressList.itfin_loan_refuses}}</td>
              </tr>
            <!--  <tr>
                <td align="center">用户被多少个不同网贷平台查询过信贷信息</td>
                <td align="center">{{ addressList.itfin_loan_queries}}</td>
              </tr>-->
             <!-- <tr>
                <td align="center">在多少不同网贷平台申请通过</td>
                <td align="center">{{ addressList.itfin_loan_approvals}}</td>
              </tr>-->

             <!-- <tr>
                <td align="center">7天内注册使用的不同网贷平台数目</td>
                <td align="center">{{ addressList.itfin_registers_7d}}</td>
              </tr>-->
              <tr>
                <td align="center">7天内在多少不同网贷平台提出过申请</td>
                <td align="center">{{ addressList.itfin_loan_applications_7d}}</td>
              </tr>
              <tr>
                <td align="center">7天内在多少不同网贷平台被拒绝</td>
                <td align="center">{{ addressList.itfin_loan_refuses_7d}}</td>
              </tr>
              <!--<tr>
                <td align="center">7天内用户被多少个不同网贷平台查询过信贷信息</td>
                <td align="center">{{ addressList.itfin_loan_queries_7d}}</td>
              </tr>-->
             <!-- <tr>
                <td align="center">7天内在多少不同网贷平台申请通过</td>
                <td align="center">{{ addressList.itfin_loan_approvals_7d}}</td>
              </tr>-->

             <!-- <tr>
                <td align="center">30天内注册使用的不同网贷平台数目</td>
                <td align="center">{{ addressList.itfin_registers_30d}}</td>
              </tr>-->
              <tr>
                <td align="center">30天内在多少不同网贷平台提出过申请</td>
                <td align="center">{{ addressList.itfin_loan_applications_30d}}</td>
              </tr>
              <tr>
                <td align="center">30天内在多少不同网贷平台被拒绝</td>
                <td align="center">{{ addressList.itfin_loan_refuses_30d}}</td>
              </tr>
              <!--<tr>
                <td align="center">30天内用户被多少个不同网贷平台查询过信贷信息</td>
                <td align="center">{{ addressList.itfin_loan_queries_30d}}</td>
              </tr>-->
             <!-- <tr>
                <td align="center">30天内在多少不同网贷平台申请通过</td>
                <td align="center">{{ addressList.itfin_loan_approvals_30d}}</td>
              </tr>-->


              <!-- <tr>
                <td align="center">60天内注册使用的不同网贷平台数目</td>
                <td align="center">{{ addressList.itfin_registers_60d}}</td>
              </tr>-->
              <tr>
                <td align="center">60天内在多少不同网贷平台提出过申请</td>
                <td align="center">{{ addressList.itfin_loan_applications_60d}}</td>
              </tr>
              <tr>
                <td align="center">60天内在多少不同网贷平台被拒绝</td>
                <td align="center">{{ addressList.itfin_loan_refuses_60d}}</td>
              </tr>
              <!-- <tr>
                <td align="center">60天内用户被多少个不同网贷平台查询过信贷信息</td>
                <td align="center">{{ addressList.itfin_loan_queries_60d}}</td>
              </tr>
               <tr>
                <td align="center">60天内在多少不同网贷平台申请通过</td>
                <td align="center">{{ addressList.itfin_loan_approvals_60d}}</td>
              </tr>-->
              <!--<tr>
                <td align="center">90天内注册使用的不同网贷平台数目</td>
                <td align="center">{{ addressList.itfin_registers_90d}}</td>
              </tr>-->
              <tr>
                <td align="center">90天内在多少不同网贷平台提出过申请</td>
                <td align="center">{{ addressList.itfin_loan_applications_90d}}</td>
              </tr>
              <tr>
                <td align="center">90天内在多少不同网贷平台被拒绝</td>
                <td align="center">{{ addressList.itfin_loan_refuses_90d}}</td>
              </tr>
              <!--<tr>
                <td align="center">90天内用户被多少个不同网贷平台查询过信贷信息</td>
                <td align="center">{{ addressList.itfin_loan_queries_90d}}</td>
              </tr>
              <tr>
                <td align="center">90天内在多少不同网贷平台申请通过</td>
                <td align="center">{{ addressList.itfin_loan_approvals_90d}}</td>
              </tr>-->


              <!--<tr>
                <td align="center">180天内注册使用的不同网贷平台数目</td>
                <td align="center">{{ addressList.itfin_registers_180d}}</td>
              </tr>-->
              <tr>
                <td align="center">180天内在多少不同网贷平台提出过申请</td>
                <td align="center">{{ addressList.itfin_loan_applications_180d}}</td>
              </tr>
              <tr>
                <td align="center">180天内在多少不同网贷平台被拒绝</td>
                <td align="center">{{ addressList.itfin_loan_refuses_180d}}</td>
              </tr>
             <!-- <tr>
                <td align="center">180天内用户被多少个不同网贷平台查询过信贷信息</td>
                <td align="center">{{ addressList.itfin_loan_queries_180d}}</td>
              </tr>-->
             <!-- <tr>
                <td align="center">180天内在多少不同网贷平台申请通过</td>
                <td align="center">{{ addressList.itfin_loan_approvals_180d}}</td>
              </tr>-->


            </table>

             <!--<el-table :data="addressList" :border="true" style="width: 100%">-->
               <!--<el-table-column prop="name" :formatter="strFormat" label="名称"  align="center"></el-table-column>-->

               <!--<el-table-column prop="count" label="数量" align="center"></el-table-column>-->
             <!--</el-table>-->
          </el-tab-pane>
        </el-tabs>
      </el-dialog>
      <!--备注-->
      <el-dialog :visible.sync="dialogFormVisible2" width="25%" :close-on-click-modal="false">
        <div slot="title">备注</div>
        <el-form :model="form2">
          <el-form-item label="备注内容">
            <el-input v-model="form2.name" :maxlength="255" type="textarea" :rows="6" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible2 = false">取 消</el-button>
          <el-button type="primary" @click="submit1">确 定</el-button>
        </div>
      </el-dialog>
    </el-row>
  </div>
</template>

<script type="text/ecmascript-6">
  import {post} from '@/utils/http'
//  import {formatStr} from '@/utils/utils'
  import BigImg from '@/components/common/Img.vue';

  export default {
    data() {
      let validateName = (rule, value, callback) => {
        if (value === '') {
          callback();
        } else {
          callback();
        }
      };
      let validatePhone = (rule, value, callback) => {
        if (value === '') {
          callback();
        } else {
          callback()
        }
      };
      return {
        arr: [1,2,3,4,5],
        formInline: {
          name: '',
          phone: '',
          state: ''
        },
        form2: {
          name: ''
        },
        idd: '',
        rules: {
          name: [
            { validator: validateName, trigger: 'blur' }
          ],
          phone: [
            { validator: validatePhone, trigger: 'blur' }
          ]
        },
        imgs:'',
        images:[],
        info: {},
        bank: {},
        clientAuth: {},
        borrowOrderList: [],
        dataUrgent: [],
        dataContacts: [],
        dataContactsCall:[],
        dataContactsSms: [],
        borrowDetail: [],
        dialogTableVisible: false,
        dialogFormVisible2: false,
        currentPage: 1,
        total: 0,
        size: 10,
        textarea: '',
        loading: false,
        addressList: [],
        phoneList: [],
        // 图片预览配置
        showImg:false,
        imgSrc: '',
        showImg1:false,
        imgSrc1: ''
      }
    },
    methods: {
      strFormat(row,column) {
        let tableName = row[column.property];
        if (tableName == undefined) {
          return "";
        }
        switch(tableName) {
          case 'itfin_registers':
            return '注册使用的不同网贷平台数目';
          case 'itfin_registers_7d':
            return '7天内注册使用的不同网贷平台数目';
          case 'itfin_registers_30d':
            return '30天内注册使用的不同网贷平台数目';
          case 'itfin_registers_60d':
            return '60天内注册使用的不同网贷平台数目';
          case 'itfin_registers_90d':
            return '90天内注册使用的不同网贷平台数目';
          case 'itfin_registers_180d':
            return '180天内注册使用的不同网贷平台数目';
          case 'itfin_loan_applications':
            return '在多少不同网贷平台提出过申请';
          case 'itfin_loan_applications_7d':
            return '7天内在多少不同网贷平台提出过申请';
          case 'itfin_loan_applications_30d':
            return '30天内在多少不同网贷平台提出过申请';
          case 'itfin_loan_applications_60d':
            return '60天内在多少不同网贷平台提出过申请';
          case 'itfin_loan_applications_90d':
            return '90天内在多少不同网贷平台提出过申请';
          case 'itfin_loan_applications_180d':
            return '180天内在多少不同网贷平台提出过申请';
          case 'itfin_loan_refuses':
            return '在多少不同网贷平台被拒绝';
          case 'itfin_loan_refuses_7d':
            return '7 天内在多少不同网贷平台被拒绝';
          case 'itfin_loan_refuses_30d':
            return '30 天内在多少不同网贷平台被拒绝';
          case 'itfin_loan_refuses_60d':
            return '60 天内在多少不同网贷平台被拒绝';
          case 'itfin_loan_refuses_90d':
            return '90 天内在多少不同网贷平台被拒绝';
          case 'itfin_loan_refuses_180d':
            return '180 天内在多少不同网贷平台被拒绝';
          case 'itfin_loan_queries':
            return '用户被多少个不同网贷平台查询过信贷信息';
          case 'itfin_loan_queries_7d':
            return '7天內用户被多少个不同网贷平台查询过信贷信息';
          case 'itfin_loan_queries_30d':
            return '30天内用户被多少个不同网贷平台查询过信贷信息';
          case 'itfin_loan_queries_60d':
            return '60天内用户被多少个不同网贷平台查询过信贷信息';
          case 'itfin_loan_queries_90d':
            return '90天内用户被多少个不同网贷平台查询过信贷信息';
          case 'itfin_loan_queries_180d':
            return '180天内用户被多少个不同网贷平台查询过信贷信息';
          case 'itfin_loan_approvals':
            return '在多少不同网贷平台申请通过';
          case 'itfin_loan_approvals_7d':
            return '7 天内在多少不同网贷平台申请通过';
          case 'itfin_loan_approvals_30d':
            return '30 天内在多少不同网贷平台申请通过';
          case 'itfin_loan_approvals_60d':
            return '60 天内在多少不同网贷平台申请通过';
          case 'itfin_loan_approvals_90d':
            return '90 天内在多少不同网贷平台申请通过';
          case 'itfin_loan_approvals_180d':
            return '180 天内在多少不同网贷平台申请通过';
          break;
        }
      },
      // 格式化时间
      dateFormat(row,column) {
        let tableTime = row[column.property];
        if (tableTime == undefined) {
          return "";
        }
        return this.moment(tableTime).format("YYYY-MM-DD HH:mm:ss");
      },
      remark(index,row) {
        this.dialogFormVisible2 = true;
        this.idd = row.id;
      },
      submit1() {
        post('/api/manager/v1/loan/loanRemark',{id: this.idd,remark: this.form2.name}).then((response) => {
          this.dialogFormVisible2 = false;
          this.form2.name = '';
          this.getList();
        })
      },
      outExe() {
        // 导出execle
        this.borrowOrderList.map(val=>{
          switch (val.status){
            case 0:
              val.status = '审核中';
              break;
            case 1:
              val.status = '审核失败';
              break;
            case 2:
              val.status = '审核通过';
              break;
            case 3:
              val.status = '已放款';
              break;
            case 4:
              val.status = '已到账';
              break;
          }
        })


        this.excelData = this.borrowOrderList
        this.export2Excel()
      },
      export2Excel() {
        var that = this;
        require.ensure([], () => {
          const { export_json_to_excel } = require('@/vendor/Export2Excel');
          const tHeader = ['订单号', '真实姓名','手机号','借款金额','申请日期','状态'];
          const filterVal = ['orderNo','realName','phone','loanAmount','createTime','status'];
          const list = that.excelData;
          const data = that.formatJson(filterVal, list);
          export_json_to_excel(tHeader, data, '借款订单excel');
        })
      },
      formatJson(filterVal, jsonData) {
        return jsonData.map(v => filterVal.map(j => v[j]))
      },
      search(formInline) {
        this.$refs[formInline].validate((vaild) => {
          if(vaild) {
            let para = {
              pageIndex: this.currentPage,
              pageSize: this.size
            }

            if(!this.formInline.name.replace(/\s/g, "") == '') {
              para.realName = this.formInline.name.replace(/\s/g, "")
            }
            if(!this.formInline.phone.replace(/\s/g, "") == '') {
              para.phone = this.formInline.phone.replace(/\s/g, "")
            }
            if(!this.formInline.state == '') {
              para.status = this.formInline.state
            }
            post('/api/manager/v1/loan/getLoanOrderList',para).then((response) => {
              this.borrowOrderList = response.data.data;
              this.total = response.data.totalCount;
              this.size = response.data.pageSize;
              this.borrowOrderList.map((val) => {
                val.createTime = this.moment(val.createTime).format("YYYY-MM-DD HH:mm:ss")
                let s = val.createTime.split(' ')[0]
                let t = new Date(val.createTime).getTime()
                let m = new Date( s + ' 00:00:00').getTime() < t && t < new Date(s + ' 06:00:00').getTime()
                val.m = m
              })
            })
          }
        })
      },
      reset(formInline) {
        this.$refs[formInline].resetFields();
      },
      getList() {
        post('/api/manager/v1/loan/getLoanOrderList',{pageIndex: this.currentPage,pageSize: this.size}).then((response) => {
          this.borrowOrderList = response.data.data;
          this.borrowOrderList.map((val) => {
            val.createTime = this.moment(val.createTime).format("YYYY-MM-DD HH:mm:ss")
            let s = val.createTime.split(' ')[0]
            let t = new Date(val.createTime).getTime()
            let m = (new Date( s + ' 00:00:00').getTime()) < t && t < (new Date(s + ' 06:00:00').getTime())
            val.m = m
          })
          this.total = response.data.totalCount;
          this.size = response.data.pageSize;
        })
      },
      // 借款详情
      getList1(index,row) {
        post('/api/manager/v1/loan/getLoanOrderDetail',{id: row.id,pageIndex: this.currentPage1,pageSize: this.size1}).then((response) => {
          this.borrowDetail = response.data;

          this.total1 = response.data.totalCount;
          this.imgs = response.data.livingPic;
          this.images = this.imgs.split(",");
          this.size1 = response.data.pageSize;
        })
      },
      handleSizeChange(val) {
        this.size = val;
        this.getList();
      },
      handleCurrentChange(val) {
        this.currentPage =val;
        this.getList();
      },
      check(index, row) {
        this.dialogTableVisible = true;
        post('/api/manager/v1/clientInfo/queryClientInfoById',row.clientId).then((response) => {
          this.dialogTableVisible = true;
          response.data.createTime = this.moment(response.data.createTime).format("YYYY-MM-DD HH:mm:ss")
          this.info = Object.assign({}, response.data);
          this.clientAuth = response.data.clientAuth;
          this.bank = response.data.clientBankCard;
        });
        this.getList1(index, row);
        post('/api/manager/v1/loan/getClientRiskInfo',{clientId: row.clientId}).then((response) => {

//          this.addressList = formatStr(response.data.shumei_mhl.riskDetail)
          this.addressList =JSON.parse(response.data.shumei_mhl.riskDetail);
          /*this.addressList.map((val,index) => {
            if(val.name.indexOf('_180d') > -1) {
              this.addressList.splice(index,0)
            }

            if(val.name.indexOf('_90d') > -1) {
              this.addressList.splice(index,1)
            }

            if(val.name.indexOf('_60d') > -1) {
              this.addressList.splice(index,1)
            }
          })*/
        });
        // 通讯录接口
       /* post('/api/manager/v1/clientInfo/queryClientContact',row.clientId).then((response) => {
          this.phoneList = response.data
        })*/
        // 会员信息接口
        this.dataUrgent = [];
        this.dataContacts = [];
        this.dataContactsCall = [];
        this.dataContactsSms = [];
        post('/api/manager/v1/clientInfo/getClientContacts',row.clientId ).then((response) => {
          this.dataUrgent = JSON.parse(response.data.contactsUrgent);
          this.dataContacts = JSON.parse(response.data.contacts);
          this.dataContactsCall = JSON.parse(response.data.contactsCall);
          this.dataContactsSms = JSON.parse(response.data.contactsSms);
        }).catch(function(err) {
          console.log(err)
        });
        this.getList()
      },
      agree(index, row) {
        this.$confirm('确定要通过此订单吗', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          post('/api/manager/v1/loan/checkLoanOrder',{id: row.id, status: 2}).then((response) => {
            this.$message({
              type: 'success',
              message: '通过成功!'
            });
            this.getList()
          })
        }).catch(() => {

        });

      },
      unagree(index, row) {
        this.$confirm('确定要拒绝此订单吗', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          post('/api/manager/v1/loan/checkLoanOrder',{id: row.id, status: 1}).then((response) => {
            this.getList()
          })
          this.$message({
            type: 'success',
            message: '拒绝成功!'
          });
        }).catch(() => {

        });
      },
      close() {
        this.showImg = false
        this.imgSrc = ''
        this.showImg1 = false
        this.imgSrc1 = ''
      },
      clickImg(e) {
        this.showImg = true;
        // 获取当前图片地址
        this.imgSrc = e.currentTarget.src;
      },
      viewImg(){
        this.showImg = false;
        this.imgSrc = ''
      },
      clickImg1(e) {
        this.showImg1 = true;
        this.imgSrc1 = e.currentTarget.src;
      },
      viewImg1(){
        this.showImg1 = false;
        this.imgSrc1 = '';
      }
    },
    components: {
      'big-img':BigImg
    },
    mounted(){
      this.getList();
    }
  }
</script>

<style lang='scss' scoped>
  .IDCard{
    background-color: #66BFBF;
    height: 40px;
    line-height: 40px;
    border-radius: 6px;
    padding-left: 20px;
    font-size: 20px;
  }
  .my_pic{
    margin-top:20px;
    margin-bottom:20px;
  }
  .wrap {
    /*padding: 20px;*/
    .header-wrap{
      margin-bottom: 60px;
      background-color: #66BFBF;
      border-radius: 6px;
    }
    .el-form-item {
      margin-top: 22px;
      margin-left: 22px;
    }
    .pad {
      padding-top: 20px;
      .head-line {
        background-color: #66BFBF;
        height: 40px;
        line-height: 40px;
        border-radius: 6px;
        padding-left: 20px;
        font-size: 20px;
      }
      .el-col {
        margin-top: 5px;
        margin-bottom: 5px;
      }
    }
    .card-center {
      text-align: center;
    }
    .center {
      height: 250px;
    }
    .ocr {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 250px;
    }
    .ocrr {
      width: 90%;
      height: 90%;
    }
    .center img {
      width: 100%;
      height: 100%;
    }
    .top {
      margin-top: 20px;
      float: right;
    }
    .table {
      border: 1px solid #e6ebf5;
      th {
        font-size: 20px;
        padding: 10px 10px;
        border: 1px solid #ccc;
      }
      td {
        font-size: 14px;
        padding: 10px 10px;
        border: 1px solid #ccc;
      }
    }
  }
</style>
